const cloud = require('wx-server-sdk')
var transliteration = require('transliteration');
cloud.init()
exports.main = async (event, context) => {
  var text=event.text
  var pinyin = transliteration.slugify(text, { lowercase: true, separator: '_' })
  var pinyin_arr = pinyin.split("_"); 
  var searchfeild = pinyin.replace(/_/g,"")
  for(i=0;i<pinyin_arr.length;i++)
  {
    searchfeild=searchfeild + pinyin_arr[i][0]
  }
  searchfeild = searchfeild+text
  return {
    searchfeild
  }
}